package com.company.utils;

/**
 * Created by jiayazi on 17/11/1.
 */
public class PageQuery<T> {
    //id
    private T data;
    /** 分页起始 从1开始*/
    private int pageIndex;
    /** 单页数量 */
    private int pageSize;

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public int getPageIndex() {

        return pageIndex*pageSize;
    }

    public void setPageIndex(int pageIndex) {
        if (pageIndex>0){
            this.pageIndex = pageIndex-1;
        }else {
            this.pageIndex = pageIndex;
        }
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        if (pageSize==0){
            pageSize=10;
        }
        this.pageSize = pageSize;
    }
}
